package com.cn.dlwy.mapzone.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.cn.dlwy.mapzone.R;

public class SplashActivity extends Activity {

	// 创建一个handler消息处理机制
	private Handler mMainHandler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			// 设置Intent，打开MainActivity画面
			Intent intent = new Intent(Intent.ACTION_MAIN);
			intent.setClass(getApplication(), MainActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
			// 结束当前splash画面
			SplashActivity.this.finish();
			// 实现activity的淡出淡出的动画效果
			overridePendingTransition(android.R.anim.fade_in,
					android.R.anim.fade_out);
		}
	};

	@Override
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		getWindow().setBackgroundDrawableResource(R.drawable.splash);
		mMainHandler.sendEmptyMessageDelayed(0, 2000);
	}

}
